From: Joey Hess Date: Fri, 14 Mar 2025 18:44:22 +0000 (-0400) Subject: support building with old version of bytestring X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~6^2~78 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=de6e9f5bebee3f5c469c378b8b728ae19d13be70;p=git-annex.git support building with old version of bytestring --- diff --git a/Annex/Locations.hs b/Annex/Locations.hs index 7cc52d9688..c4347de4d6 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -6,6 +6,7 @@ -} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP #-} module Annex.Locations ( keyFile, @@ -744,7 +745,7 @@ reSanitizeKeyName = preSanitizeKeyName' True keyFile :: Key -> OsPath keyFile k = let b = serializeKey'' k - in toOsPath $ if SB.any (`elem` needesc) b + in toOsPath $ if anyneedesc b then mconcat $ map esc (SB.unpack b) else b where @@ -757,6 +758,12 @@ keyFile k = needesc = map (fromIntegral . ord) ['&', '%', ':', '/'] +#if MIN_VERSION_bytestring(0,11,3) + anyneedesc = SB.any (`elem` needesc) +#else + anyneedesc = any (`elem` needesc) . SB.unpack +#endif + {- Reverses keyFile, converting a filename fragment (ie, the basename of - the symlink target) into a key. -} fileKey :: OsPath -> Maybe Key